package com.jt.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jt.pojo.User;
import com.jt.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/user")
public class AxiosUserController {
    @Autowired
    private UserService userService;
    @GetMapping("/findAll")
    public List<User> findAll(){
        return userService.findAll();
    }
    @PutMapping("/update")
    public void update(@RequestBody User user){
        System.err.println(user);
        QueryWrapper qw=new QueryWrapper();
        qw.eq("id", user.getId());

       // userService.update(user,qw );
    }
    @DeleteMapping("/delete/{id}")
    public void delete(@PathVariable Integer id){
        userService.delete(id);
    }
}
